import sys
import os

print("Python version:", sys.version)
print("\nPython executable:", sys.executable)
print("\nCurrent working directory:", os.getcwd())
print("\nPython search paths (sys.path):")
for path in sys.path:
    print(f"  {path}")

print("\nUser site-packages directory:")
user_site = None
try:
    import site
    user_site = site.getusersitepackages()
    print(f"  {user_site}")
    print(f"  Exists: {os.path.exists(user_site)}")
    if os.path.exists(user_site):
        print("  Contents:")
        for item in os.listdir(user_site):
            print(f"    {item}")
except Exception as e:
    print(f"  Error: {e}")

print("\nTrying to import proglog directly...")
try:
    import proglog
    print(f"  ✓ Successfully imported proglog version {proglog.__version__}")
    print(f"  Location: {proglog.__file__}")
except ImportError as e:
    print(f"  ❌ ImportError: {e}")
    # Try adding user site-packages to path
    if user_site:
        print(f"\nTrying to add user site-packages ({user_site}) to path...")
        if user_site not in sys.path:
            sys.path.append(user_site)
            print(f"  Added {user_site} to sys.path")
        else:
            print(f"  Already in sys.path")
        # Try importing again
        try:
            import proglog
            print(f"  ✓ Successfully imported proglog after adding path")
        except ImportError as e2:
            print(f"  ❌ Still failed: {e2}")

print("\nSuggested solutions:")
print("1. Create a virtual environment (recommended):")
print("   python -m venv venv")
print("   .\\venv\\Scripts\\activate")
print("   pip install -r requirements.txt")
print("2. Update pip:")
print("   python -m pip install --upgrade pip --user")
print("3. Install proglog with specific version:")
print("   python -m pip install proglog==0.1.10 --user --force-reinstall")